<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//创建用户基本信息表
        Schema::create('users', function(Blueprint $table)
        {
            $table->increments('id');                               //用户id
            $table->string('username')->unique()->nullable();       //用户名
            $table->string('email')->unique()->nullable();          //邮箱
            $table->string('phone')->unique()->nullable();          //电话
            $table->string('password');                             //密码
            $table->string('reg_ip');                               //注册ip
            $table->timestamp('reg_time');                          //注册时间
            $table->string('login_ip')->nullable();                 //最后登录ip
            $table->timestamp('login_time')->nullable();            //最后登录时间
            $table->integer('login_count')->nullable();             //登录次数
            $table->integer('role')->default(0);                    //登录角色
            $table ->integer('status')->nullable();                 //用户状态
            $table->rememberToken();
            $table->softDeletes();
            $table->timestamps();

        });

	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('users');
	}

}
